package com.baidu.day02;

import java.util.HashSet;
import java.util.Set;

/**
 * Create with Intellij IDEA
 *
 * @Author Q
 * @date 2021/11/23/16:35
 */
public class HashSetDemo {
    public static void main(String[] args) {
        Set<String> set = new HashSet<>();
        set.add("a");
        set.add("b");
        set.add("a");
        set.add("c");

        System.out.println(set.size());

        for (String s : set) {
            System.out.println(s);
        }
        System.out.println("===华丽丽的分割线===");

        Set<Student> students = new HashSet<>();

        Student s1 = new Student(1,"霍针");
//        System.out.println(s1.getClass().getName()+"@"+Integer.toHexString(s1.hashCode()));

        Student s2 = new Student(2,"吴签");
        Student s3 = new Student(3,"李泽鑫");
        Student s4 = new Student(1,"霍针");

        students.add(s1);
        students.add(s2);
        students.add(s3);
        students.add(s4);

        for (Student student : students) {
            System.out.println(student);
        }

    }
}
